/*****************************************************************************
 *
 * 作   者: 杨兵 * 创建时间: 2020/12/16 20:06:12 *
 * Copyright (C) 2008 - 鹏业软件公司
 *
 *****************************************************************************/

import {DataPacket, NorDataList} from 'pengesoft-ng-lib';

/**
 * 招聘计划信息表
 */
export class RecruitmentPlan extends DataPacket {
  Id: number; // 主键
  DeptId: number; // 招聘部门编号
  PushDate: Date | string; // 申请时间
  JobId: string; // 招聘岗位编号
  TargetCount: number; // 招聘数量
  Establishment: number; // 编制数量
  WorkerCount: number; // 在岗数量
  JobLevel: number; // 岗位级别
  LowTrialSalary: number; // 最低试用薪酬
  HighTrialSalary: number; // 最高试用薪酬
  LowRegularSalary: number; // 最低转正薪酬
  HighRegularSalary: number; // 最高转正薪酬
  Reason: number; // 招聘原因：1增编、2替换、3调岗、4其他
  Way: number; // 招聘方式：1校招、2社招、3猎头
  ReasonDescription: string; // 招聘原因说明
  Major: string; // 参考专业
  FirstInterviewer: string; // 初试面试官
  ReInterviewer: string; // 复试面试官
  Duty: string; // 工作职责
  Claim: string; // 招聘要求
  TestQuestions: boolean; // 测试题有无
  TestType: string; // 测试题格式
  CheckStatus: number; // 审核状态：1提交、2驳回、3事业部经理审核、4人事部确认、5总经理确认
  Status: number; // 招聘状态：1审核、2进行、3归档
  Remark: string; // 备注

  constructor(options: {
    Id?: number;
    DeptId?: number;
    PushDate?: Date | string;
    JobId?: string;
    TargetCount?: number;
    Establishment?: number;
    WorkerCount?: number;
    JobLevel?: number;
    LowTrialSalary?: number;
    HighTrialSalary?: number;
    LowRegularSalary?: number;
    HighRegularSalary?: number;
    Reason?: number;
    Way?: number;
    ReasonDescription?: string;
    Major?: string;
    FirstInterviewer?: string;
    ReInterviewer?: string;
    Duty?: string;
    Claim?: string;
    TestQuestions?: boolean;
    TestType?: string;
    CheckStatus?: number;
    Status?: number;
    Remark?: string;
  } = {}) {
    super();
    this.Id = !options.Id ? 0 : Number.parseFloat(options.Id.toString());
    this.DeptId = !options.DeptId ? 0 : Number.parseFloat(options.DeptId.toString());
    this.PushDate = this.newDate(options.PushDate);
    this.JobId = options.JobId || '';
    this.TargetCount = !options.TargetCount ? 0 : Number.parseFloat(options.TargetCount.toString());
    this.Establishment = !options.Establishment ? 0 : Number.parseFloat(options.Establishment.toString());
    this.WorkerCount = !options.WorkerCount ? 0 : Number.parseFloat(options.WorkerCount.toString());
    this.JobLevel = !options.JobLevel ? 0 : Number.parseFloat(options.JobLevel.toString());
    this.LowTrialSalary = !options.LowTrialSalary ? 0 : Number.parseFloat(options.LowTrialSalary.toString());
    this.HighTrialSalary = !options.HighTrialSalary ? 0 : Number.parseFloat(options.HighTrialSalary.toString());
    this.LowRegularSalary = !options.LowRegularSalary ? 0 : Number.parseFloat(options.LowRegularSalary.toString());
    this.HighRegularSalary = !options.HighRegularSalary ? 0 : Number.parseFloat(options.HighRegularSalary.toString());
    this.Reason = !options.Reason ? 0 : Number.parseFloat(options.Reason.toString());
    this.Way = !options.Way ? 0 : Number.parseFloat(options.Way.toString());
    this.ReasonDescription = options.ReasonDescription || '';
    this.Major = options.Major || '';
    this.FirstInterviewer = options.FirstInterviewer || '';
    this.ReInterviewer = options.ReInterviewer || '';
    this.Duty = options.Duty || '';
    this.Claim = options.Claim || '';
    this.TestQuestions = !!options.TestQuestions;
    this.TestType = options.TestType || '';
    this.CheckStatus = !options.CheckStatus ? 0 : Number.parseFloat(options.CheckStatus.toString());
    this.Status = !options.Status ? 0 : Number.parseFloat(options.Status.toString());
    this.Remark = options.Remark || '';
  }
}

/**
 * 招聘计划信息表列表
 */
export class RecruitmentPlanList extends NorDataList<RecruitmentPlan> {

  constructor(options: {
    _Items?: Array<RecruitmentPlan>
  } = {}) {
    super();
    if (options._Items) {
      for (const item of options._Items) {
        this.append(new RecruitmentPlan(item));
      }
    }
  }
}